package com.leesche.zcsp.node.web.vo;

import com.leesche.zcsp.node.utils.calculator.Calculation;
import com.leesche.zcsp.node.web.constants.Constants;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Jerry Chan
 * @version V1.0
 * @Title: node
 * @Package com.leesche.zcsp.node.web.vo
 * @Description:( 具体设备的统计VO类 )
 * @date 2016年10月31日 19:48
 */
public class DeviceStatistic implements Serializable {

    private String placeName;
    private Long deviceid;
    private String deviceName;
    private String statisticDate;

    private String total;
    private String noCashTotal;
    private String billTotal;
    private String wechatTotal;
    private String alipayTotal;
    private long coinTotal = 0;
    private long oneBalance = 0;
    private long fiveBalance = 0;
    private long tenBalance = 0;
    private long twentyBalance = 0;
    private long fiftyBalance = 0;
    private long hundredBalance = 0;

    private long billCount = 0;
    private String subtotal;

    private Long gameCoinQuantity; //gameCoinBalance
    private Long giftSellQuantity;      //giftBalance
    private Long outGameCoinQuantity;   //CoinBalance
    private Integer remotelyOutGameCoinQuantity; //intdata2


    public DeviceStatistic() {
    }

    /**
     * @Title: DeviceStatisticToZero
     * @Description: TODO(初始归零)
     * @author Jerry
     * @date 2016-11-02 08:44:50
     */
    public void deviceStatisticToZero() {
        this.total = "0.00";
        this.noCashTotal = "0.00";
        this.billTotal = "0.00";
        this.wechatTotal = "0.00";
        this.alipayTotal = "0.00";
        this.coinTotal = 0;
        this.oneBalance = 0;
        this.fiveBalance = 0;
        this.tenBalance = 0;
        this.twentyBalance = 0;
        this.fiftyBalance = 0;
        this.hundredBalance = 0;
        this.billCount = 0;
        this.gameCoinQuantity = 0L;
        this.giftSellQuantity = 0L;
        this.outGameCoinQuantity = 0L;
        this.remotelyOutGameCoinQuantity = 0;
    }

    public DeviceStatistic(String placeName, Long deviceid, String deviceName, String statisticDate) {
        this.placeName = placeName;
        this.deviceid = deviceid;
        this.deviceName = deviceName;
        this.statisticDate = statisticDate;
    }

    /**
     * @param gameCoinBalance 收入的游戏币数量
     * @param giftBalance     出品的礼品数量
     * @param coinBalance     出品的游戏币数量
     * @param remotelyOutCoin 远程吐币的数量
     * @return
     * @Title: statisticNotMoney
     * @Description: TODO(统计出品量)
     * @author Jerry
     * @date 2016-11-01 12:14:40
     */
    public void statisticNotMoney(Long gameCoinBalance, Long giftBalance, Long coinBalance, Integer remotelyOutCoin) {
        this.gameCoinQuantity = gameCoinBalance;
        this.giftSellQuantity = giftBalance;
        this.outGameCoinQuantity = coinBalance;
        this.remotelyOutGameCoinQuantity = remotelyOutCoin;
    }

    /**
     * @param oneBalance     一元面额数量
     * @param fiveBalance    五元面额数量
     * @param tenBalance     十元面额数量
     * @param twentyBalance  二十元面额数量
     * @param fiftyBalance   五十元面额数量
     * @param hundredBalance 一百元面额数量
     * @Title: statisticCash
     * @Description: TODO(纸币面额统计)
     * @author Jerry
     * @date 2016-11-01 09:53:29
     */
    public void statisticCash(Long oneBalance, Long fiveBalance, Long tenBalance, Long twentyBalance, Long fiftyBalance, Long hundredBalance) {
        this.oneBalance = oneBalance;
        this.fiveBalance = fiveBalance;
        this.tenBalance = tenBalance;
        this.twentyBalance = twentyBalance;
        this.fiftyBalance = fiftyBalance;
        this.hundredBalance = hundredBalance;
        //纸币张数
        this.billCount = this.oneBalance + this.fiveBalance + this.tenBalance + this.twentyBalance + this.fiftyBalance + this.hundredBalance;
    }

    /**
     * @Title: statisticSubtotal
     * @Description: TODO(统计小计总额)
     * @author Jerry
     * @date 2016-11-03 06:54:44
     */
    public Long statisticSubtotal() {
        Long billmoney = (this.oneBalance * 1) + (this.fiveBalance * 5) + (this.tenBalance * 10) + (this.twentyBalance * 20) + (this.fiftyBalance * 50) + (this.hundredBalance * 100);
        this.subtotal = Constants.DECIMAL_FORMAT.format(billmoney);
        return billmoney;
    }

    /**
     * @param coinTotal   硬币收入
     * @param billTotal   纸钞收入
     * @param wechatTotal 微信支付收入
     * @param alipayTotal 支付宝支付收入
     * @Title: statisticTotal
     * @Description: TODO(统计收入各项总额)
     * @author Jerry
     * @date 2016-11-01 09:51:39
     */
    public void statisticTotal(Long coinTotal, Long billTotal, Long wechatTotal, Long alipayTotal) {
        this.coinTotal = coinTotal;
        BigDecimal bigWechatTotal = new BigDecimal(wechatTotal).divide(Constants.percentage);
        BigDecimal bigAlipayTotal = new BigDecimal(alipayTotal).divide(Constants.percentage);
        BigDecimal bigCoinTotal = new BigDecimal(coinTotal);
        this.noCashTotal = Constants.DECIMAL_FORMAT.format(bigWechatTotal.add(bigAlipayTotal).add(bigCoinTotal).doubleValue());

        BigDecimal bigNoCashTotal = new BigDecimal(noCashTotal);
        BigDecimal bigBillTotal = new BigDecimal(billTotal);

        this.total = Constants.DECIMAL_FORMAT.format(bigNoCashTotal.add(bigBillTotal));
        this.billTotal = Constants.DECIMAL_FORMAT.format(billTotal);
        this.wechatTotal = Constants.DECIMAL_FORMAT.format(bigWechatTotal.doubleValue());
        this.alipayTotal = Constants.DECIMAL_FORMAT.format(bigAlipayTotal.doubleValue());

    }

    public String getPlaceName() {
        return placeName;
    }

    public void setPlaceName(String placeName) {
        this.placeName = placeName;
    }

    public Long getDeviceid() {
        return deviceid;
    }

    public void setDeviceid(Long deviceid) {
        this.deviceid = deviceid;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getStatisticDate() {
        return statisticDate;
    }

    public void setStatisticDate(String statisticDate) {
        this.statisticDate = statisticDate;
    }

    public String getTotal() {
        return total;
    }

    public void setTotal(String total) {
        this.total = total;
    }

    public String getNoCashTotal() {
        return noCashTotal;
    }

    public void setNoCashTotal(String noCashTotal) {
        this.noCashTotal = noCashTotal;
    }

    public String getBillTotal() {
        return billTotal;
    }

    public void setBillTotal(String billTotal) {
        this.billTotal = billTotal;
    }

    public String getWechatTotal() {
        return wechatTotal;
    }

    public void setWechatTotal(String wechatTotal) {
        this.wechatTotal = wechatTotal;
    }

    public String getAlipayTotal() {
        return alipayTotal;
    }

    public void setAlipayTotal(String alipayTotal) {
        this.alipayTotal = alipayTotal;
    }

    public long getCoinTotal() {
        return coinTotal;
    }

    public void setCoinTotal(long coinTotal) {
        this.coinTotal = coinTotal;
    }

    public long getOneBalance() {
        return oneBalance;
    }

    public void setOneBalance(long oneBalance) {
        this.oneBalance = oneBalance;
    }

    public long getFiveBalance() {
        return fiveBalance;
    }

    public void setFiveBalance(long fiveBalance) {
        this.fiveBalance = fiveBalance;
    }

    public long getTenBalance() {
        return tenBalance;
    }

    public void setTenBalance(long tenBalance) {
        this.tenBalance = tenBalance;
    }

    public long getTwentyBalance() {
        return twentyBalance;
    }

    public void setTwentyBalance(long twentyBalance) {
        this.twentyBalance = twentyBalance;
    }

    public long getFiftyBalance() {
        return fiftyBalance;
    }

    public void setFiftyBalance(long fiftyBalance) {
        this.fiftyBalance = fiftyBalance;
    }

    public long getHundredBalance() {
        return hundredBalance;
    }

    public void setHundredBalance(long hundredBalance) {
        this.hundredBalance = hundredBalance;
    }

    public Long getGameCoinQuantity() {
        return gameCoinQuantity;
    }

    public void setGameCoinQuantity(Long gameCoinQuantity) {
        this.gameCoinQuantity = gameCoinQuantity;
    }

    public Long getGiftSellQuantity() {
        return giftSellQuantity;
    }

    public void setGiftSellQuantity(Long giftSellQuantity) {
        this.giftSellQuantity = giftSellQuantity;
    }

    public Long getOutGameCoinQuantity() {
        return outGameCoinQuantity;
    }

    public void setOutGameCoinQuantity(Long outGameCoinQuantity) {
        this.outGameCoinQuantity = outGameCoinQuantity;
    }

    public Integer getRemotelyOutGameCoinQuantity() {
        return remotelyOutGameCoinQuantity;
    }

    public void setRemotelyOutGameCoinQuantity(Integer remotelyOutGameCoinQuantity) {
        this.remotelyOutGameCoinQuantity = remotelyOutGameCoinQuantity;
    }

    public long getBillCount() {
        return billCount;
    }

    public void setBillCount(long billCount) {
        this.billCount = billCount;
    }

    public String getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(String subtotal) {
        this.subtotal = subtotal;
    }
}
